package com.study.common.transaction;

import org.springframework.data.redis.core.RedisTemplate;

/**
 * @author yaojinshan
 * @version 1.0
 * @description: 红包的分布式事务类
 * @date 2019/5/31 14:36
 */
public class RedPacketDistributedTransaction extends AbstarctDistributedTransaction {
    private String redPacketId;
    private String orderId;
    //如果使用的是dubbo 服务 则传入对应的 facade
    //private RedPacketFacade redPacketFacade;
    //如果要使用redis服务 则需要传入redisTemplate
    private RedisTemplate redisTemplate;

    @Override
    public boolean execute() {
        //红包事务的正常业务
        return false;
    }

    @Override
    public boolean rollback() {
        //红包事务的回退业务

        return false;
    }


    public RedPacketDistributedTransaction() {

    }

    public RedPacketDistributedTransaction(String redPacketId, String orderId, RedisTemplate redisTemplate) {
        this.redPacketId = redPacketId;
        this.orderId = orderId;
        this.redisTemplate = redisTemplate;
    }

    public String getRedPacketId() {
        return redPacketId;
    }

    public void setRedPacketId(String redPacketId) {
        this.redPacketId = redPacketId;
    }

    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    public RedisTemplate getRedisTemplate() {
        return redisTemplate;
    }

    public void setRedisTemplate(RedisTemplate redisTemplate) {
        this.redisTemplate = redisTemplate;
    }
}
